<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Book
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 * @version    $Id: Controller.php 8369 2011-02-01 06:14:57Z john $
 * @author     John
 */

/**
 * @category   Application_Extensions
 * @package    Book
 * @copyright  Copyright 2006-2010 Webligo Developments
 * @license    http://www.socialengine.net/license/
 */
class Book_Widget_HomepageBooksController extends Engine_Content_Widget_Abstract {

    public function indexAction() {

        //menu
        $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')
                ->getNavigation('book_main');

        //table books 
        $bookTb = Engine_Api::_()->getDbTable('books', 'book');

        //select book to display
        $select = $bookTb->select();

        //phan trang
        $this->view->books = $books = Zend_Paginator::factory($select);
        $page = $this->_getParam('page', 1);
        $books->setItemCountPerPage(10);
        $books->setCurrentPageNumber($page);
    }

}
